% orig code: https://zhuanlan.zhihu.com/p/471457420
function [C]=Bezier_gen(ctrls,accuracy)
x=0;
y=0;

t=0:accuracy:1;
n=size(ctrls,1);
for i=0:n-1
    B=nchoosek(n-1,i).*t.^i.*(1-t).^(n-1-i);
    x=x+ctrls(i+1,1)*B;
    y=y+ctrls(i+1,2)*B;
end

C(:,1)=x;
C(:,2)=y;
end